<?php

class Webote_Form_UserLogin extends Webote_Form
{

    public function init()
    {
        $this->setAction('/user/login');

        // Display Group #1 : Credentials

        $this->addElement('text', 'name', array(
            'decorators' => $this->_standardElementDecorator,
            'label' => 'Name:',
            'validators' => array(
                array('StringLength', false, array(3,20))
            ),
            'required' => true
        ));

        $this->addElement('password', 'password', array(
            'decorators' => $this->_standardElementDecorator,
            'label' =>'Password:',
            'required' => true
        ));

        $this->addDisplayGroup(
            array('name', 'password'), 'authorlogin',
            array(
                'disableLoadDefaultDecorators' => true,
                'decorators' => $this->_standardGroupDecorator,
                'legend' => 'Credentials'
            )
        );

        // Display Group #2 : Submit

        $this->addElement('submit', 'submit', array(
            'decorators' => $this->_buttonElementDecorator,
            'label' => 'Submit'
        ));

        $this->addDisplayGroup(
            array('submit'), 'authorloginsubmit',
            array(
                'disableLoadDefaultDecorators' => true,
                'decorators' => $this->_buttonGroupDecorator,
                'class' => 'submit'
            )
        );
    }

}